<!DOCTYPE html>
<html lang="zh_CN">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
/*开启BFC的作用：
1.不会被浮动元素所覆盖
2.可以使子元素和父元素的外边距不会重叠
3.可以使父元素包含浮动的子元素
*/
        .box1{
            width: 200px;
            height: 200px;
            background-color: aquamarine;
/*若不开启BFC，父元素会随子元素移动*/
            overflow: hidden;
        }
        .box2{
            width:100px;
            height: 100px;
            background-color: orange;
            margin-top: 100px;
        }
        .box3{
            width:100px;
            height: 100px;
            background-color: antiquewhite;
            float: left;
        }
        .box4{
            width:100px;
            height: 100px;
            background-color: blue;
            overflow: hidden;
/* 若不开启BFC，box3会把box4覆盖掉 */
        }
    </style>
</head>
<body>
    <div class="box1">
        <div class="box2"></div>
    </div>
    <div class="box3"></div>
    <div class="box4"></div>
</body>
</html>